'\" t
.TH "SD_BUS_GET_NAME_CREDS" "3" "" "systemd 256.7" "sd_bus_get_name_creds"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
sd_bus_get_name_creds, sd_bus_get_owner_creds \- Query bus client credentials
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <systemd/sd\-bus\&.h>
.fi
.ft
.HP \w'int\ sd_bus_get_name_creds('u
.BI "int sd_bus_get_name_creds(sd_bus\ *" "bus" ", const\ char\ *" "name" ", uint64_t\ " "mask" ", sd_bus_creds\ **" "creds" ");"
.HP \w'int\ sd_bus_get_owner_creds('u
.BI "int sd_bus_get_owner_creds(sd_bus\ *" "bus" ", uint64_t\ " "mask" ", sd_bus_creds\ **" "creds" ");"
.SH "DESCRIPTION"
.PP
\fBsd_bus_get_name_creds()\fR
queries the credentials of the bus client identified by
\fIname\fR\&. The
\fImask\fR
parameter is a combo of
\fBSD_BUS_CREDS_*\fR
flags that indicate which credential info the caller is interested in\&. See
\fBsd_bus_creds_new_from_pid\fR(3)
for a list of possible flags\&. On success,
\fIcreds\fR
contains a new
sd_bus_creds
instance with the requested information\&. Ownership of this instance belongs to the caller and it should be freed once no longer needed by calling
\fBsd_bus_creds_unref\fR(3)\&.
.PP
\fBsd_bus_get_owner_creds()\fR
queries the credentials of the creator of the given bus\&. The
\fImask\fR
and
\fIcreds\fR
parameters behave the same as in
\fBsd_bus_get_name_creds()\fR\&.
.SH "RETURN VALUE"
.PP
On success, these functions return a non\-negative integer\&. On failure, they return a negative errno\-style error code\&.
.SS "Errors"
.PP
Returned errors may indicate the following problems:
.PP
\fB\-EINVAL\fR
.RS 4
An argument is invalid\&.
.RE
.PP
\fB\-ENOPKG\fR
.RS 4
The bus cannot be resolved\&.
.RE
.PP
\fB\-EPERM\fR
.RS 4
The bus has already been started\&.
.RE
.PP
\fB\-ECHILD\fR
.RS 4
The bus was created in a different process, library or module instance\&.
.RE
.PP
\fB\-ENOMEM\fR
.RS 4
Memory allocation failed\&.
.RE
.SH "NOTES"
.PP
Functions described here are available as a shared library, which can be compiled against and linked to with the
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
file\&.
.PP
The code described here uses
\fBgetenv\fR(3), which is declared to be not multi\-thread\-safe\&. This means that the code calling the functions described here must not call
\fBsetenv\fR(3)
from a parallel thread\&. It is recommended to only do calls to
\fBsetenv()\fR
from an early phase of the program when no other threads have been started\&.
.SH "HISTORY"
.PP
\fBsd_bus_get_name_creds()\fR
and
\fBsd_bus_get_owner_creds()\fR
were added in version 221\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_creds_unref\fR(3)
